<?php

namespace Iaem\HomeBundle\Twig;

class IaemHomeExtension extends \Twig_Extension
{

    /**
     * Returns the name of the extension.
     *
     * @return string The extension name
     */
    public function getName()
    {
        return 'iaem_home_extension';
    }

    public function getFilters()
    {
        return [
            new \Twig_SimpleFilter('timeToDate', array($this, 'dateFilter'))
        ];
    }

    public function dateFilter($timestamp)
    {
        return (new \DateTime())->setTimestamp($timestamp)->format('Y-m-d H:i:s');
    }
}
